home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-12-31 | 66.7 KB | 1,800 lines | [TEXT/R*ch] |
- Received-Date: Sun, 12 Jun 1994 14:10:25 +0200
- From: pottier@clipper.ens.fr (Francois Pottier)
- Subject: csmp-digest-v3-034
- To: csmp-digest@ens.fr
- Date: Sun, 12 Jun 1994 14:10:18 +0200 (MET DST)
- X-Mailer: ELM [version 2.4 PL23]
- Mime-Version: 1.0
- Content-Type: text/plain; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
- Errors-To: listman@ens.fr
- Reply-To: pottier@clipper.ens.fr
- X-Sequence: 37
-
- C.S.M.P. Digest Sun, 12 Jun 94 Volume 3 : Issue 34
-
- Today's Topics:
-
- 32-Bit Addressing
- AppleScript Questions
- Code Warrior allocation of Objects
- Code Warrior: ruminations of a long-time MPW user
- Refinement of SC++ 7.0 code gen bug
- Serial Port Programming?
- Serial port use
- THINK Class Library FTP Site?
- storage for XCMDS
-
-
-
- The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
- (pottier@clipper.ens.fr).
-
- The digest is a collection of article threads from the internet newsgroup
- comp.sys.mac.programmer. It is designed for people who read c.s.m.p. semi-
- regularly and want an archive of the discussions. If you don't know what a
- newsgroup is, you probably don't have access to it. Ask your systems
- administrator(s) for details. If you don't have access to news, you may
- still be able to post messages to the group by using a mail server like
- anon.penet.fi (mail help@anon.penet.fi for more information).
-
- Each issue of the digest contains one or more sets of articles (called
- threads), with each set corresponding to a 'discussion' of a particular
- subject. The articles are not edited; all articles included in this digest
- are in their original posted form (as received by our news server at
- nef.ens.fr). Article threads are not added to the digest until the last
- article added to the thread is at least two weeks old (this is to ensure that
- the thread is dead before adding it to the digest). Article threads that
- consist of only one message are generally not included in the digest.
-
- The digest is officially distributed by two means, by email and ftp.
-
- If you want to receive the digest by mail, send email to listserv@ens.fr
- with no subject and one of the following commands as body:
- help Sends you a summary of commands
- subscribe csmp-digest Your Name Adds you to the mailing list
- signoff csmp-digest Removes you from the list
- Once you have subscribed, you will automatically receive each new
- issue as it is created.
-
- The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
- Questions related to the ftp site should be directed to
- scott.silver@dartmouth.edu. Currently no previous volumes of the CSMP
- digest are available there.
-
- Also, the digests are available to WAIS users. To search back issues
- with WAIS, use comp.sys.mac.programmer.src. With Mosaic, use
- http://www.wais.com/wais-dbs/comp.sys.mac.programmer.html.
-
-
- -------------------------------------------------------
-
- >From spencerl@crl.com (Spencer Low)
- Subject: 32-Bit Addressing
- Date: 20 May 1994 18:43:48 -0700
- Organization: LowTek Creations
-
- How do you detect whether 32-bit Addressing is enabled/disabled? Also,
- how can you turn it on? I remember reading somewhere that there's a bit
- in PRAM that you can modify. Does anyone have any specifics or sample
- code (THINK C)? I realize that the Mac would be require to be rebooted,
- but I would still like an automated way to turn it on (with the
- authorization of the user).
-
- Thanks,
- Spencer
-
-
- --
- Spencer Low | Creators of MaxRAM!!
- LowTek Creations | Anonymous FTP to crl.com and look in
- spencerl@crl.com | /users/ro/spencerl/ for more info.
-
- +++++++++++++++++++++++++++
-
- >From jwbaxter@olympus.net (John W. Baxter)
- Date: Fri, 20 May 1994 23:12:09 -0700
- Organization: Internet for the Olympic Peninsula
-
- In article <2rjp0k$cqe@crl2.crl.com>, spencerl@crl.com (Spencer Low) wrote:
-
- > How do you detect whether 32-bit Addressing is enabled/disabled? Also,
- > how can you turn it on? I remember reading somewhere that there's a bit
- > in PRAM that you can modify. Does anyone have any specifics or sample
- > code (THINK C)? I realize that the Mac would be require to be rebooted,
- > but I would still like an automated way to turn it on (with the
- > authorization of the user).
-
- Send a 4 byte -1 through the StripAddress trap, and see what comes out.
- --
- John Baxter Port Ludlow, WA, USA [West shore, Puget Sound]
- jwbaxter@pt.olympus.net
-
- +++++++++++++++++++++++++++
-
- >From spencerl@crl.com (Spencer Low)
- Date: 21 May 1994 00:08:14 -0700
- Organization: LowTek Creations
-
- John W. Baxter (jwbaxter@olympus.net) wrote:
- > Send a 4 byte -1 through the StripAddress trap, and see what comes out.
-
- I just tried that and StripAddress returned 0xFFFFFFFF, or -1. What will
- it return in 24-bit mode? 0x00FFFFFF?
-
- I think I just answered my own question (well, part of it)...
- GestaltEqu.h tells me that the gestaltAddressingModeAttr selector will
- tell me about the addressing mode of the Mac. Just test for bit 0
- (gestalt32BitAddressing).
-
- So how do I turn it on? And I shouldn't turn it on if gestalt32BitCapable
- is false?
-
- Thanks,
- Spencer
- --
- Spencer Low | Creators of MaxRAM!!
- LowTek Creations | Anonymous FTP to crl.com and look in
- spencerl@crl.com | /users/ro/spencerl/ for more info.
-
- +++++++++++++++++++++++++++
-
- >From spencerl@crl.com (Spencer Low)
- Date: 21 May 1994 12:47:41 -0700
- Organization: LowTek Creations
-
- Spencer Low (spencerl@crl.com, aka "me") wrote:
- > So how do I turn it on? And I shouldn't turn it on if gestalt32BitCapable
- > is false?
-
- I did soom searching on the 'net (the alt.sources.mac archive) and I
- found out some information about extended PRAM (XPRAM) and memory
- settings. I looked at the Extended PRAM Layout from Kiselyov Oleg
- (oleg@ponder.csci.unt.edu) and I copied/composed the following code:
-
- (THINK C style with inline assembly)
-
- char buffer;
-
- asm {
- LEA buffer, A0 // pass the address as a parameter
- MOVE.W #1, D0 // the length of the data
- SWAP D0
- MOVE.W #0x8A, D0 // location in XPRAM
- DC.W 0xA051 // ReadXPRam trap
- }
- BitSet( &buffer, 15 ); // Set xxxx x1x1 (should mean 32-bit on)
- BitSet( &buffer, 13 );
- asm {
- LEA buffer, A0 // pass the address as a parameter
- MOVE.W #1, D0 // the length of the data
- SWAP D0
- MOVE.W #0x8A, D0 // location in XPRAM
- DC.W 0xA052 // WriteXPRam trap
- }
-
- Kiselyov Oleg's info tells us the following:
-
- Loc Length
- (hex) (dec)
- 8A 1 Bit field: Memory/cache control flags
- 1xxx xxxx 68040 Cache is OFF | Toggled through Cache control
- 0xxx xxxx 68040 Cache is ON | panel
- xxxx x1x1 32-bit addressing is ON (toggled through the Memory
- control panel)
-
- So it seems like my code is setting the right stuff, correct? Does my
- code make sense? I can't test it on my 660AV, since the 660AV doesn't
- support 24-bit mode (or does it?). Also, I noticed that Kiselyov's info
- says 1xxx xxxx means that the cache is off, but on my Mac, my cache is on
- and ReadXPRam returns 1xxx xxxx. Is there a typo or something?
-
- Thanks in advance for your help,
-
- Spencer
- --
- Spencer Low | Creators of MaxRAM!!
- LowTek Creations | Anonymous FTP to crl.com and look in
- spencerl@crl.com | /users/ro/spencerl/ for more info.
-
- +++++++++++++++++++++++++++
-
- >From spencerl@crl.com (Spencer Low)
- Date: 21 May 1994 14:00:02 -0700
- Organization: LowTek Creations
-
- Spencer Low (spencerl@crl.com) wrote:
- > BitSet( &buffer, 15 ); // Set xxxx x1x1 (should mean 32-bit on)
- > BitSet( &buffer, 13 );
-
- Whoops! This code should be BitSet(&buffer, 5); & BitSet(&buffer, 7);
- instead. (this is the first time I've ever used BitSet.)
-
- > Kiselyov Oleg's info tells us the following:
-
- > Loc Length
- > (hex) (dec)
- > 8A 1 Bit field: Memory/cache control flags
- > 1xxx xxxx 68040 Cache is OFF | Toggled through Cache control
- > 0xxx xxxx 68040 Cache is ON | panel
- > xxxx x1x1 32-bit addressing is ON (toggled through the Memory
- > control panel)
-
- > So it seems like my code is setting the right stuff, correct? Does my
- > code make sense? I can't test it on my 660AV, since the 660AV doesn't
- > support 24-bit mode (or does it?). Also, I noticed that Kiselyov's info
- > says 1xxx xxxx means that the cache is off, but on my Mac, my cache is on
- > and ReadXPRam returns 1xxx xxxx. Is there a typo or something?
-
- It seems like I was the one making the typo. I checked on my calculator
- (conversions) and ReadXPRam was returning x1xx x1x1, meaning that 32-bit
- addressing was on and the cache was on. I don't know what that second "1"
- means, though. Perhaps it means that 32-bit can't be turned off?
-
- Spencer
- --
- Spencer Low | Creators of MaxRAM!!
- LowTek Creations | Anonymous FTP to crl.com and look in
- spencerl@crl.com | /users/ro/spencerl/ for more info.
-
- +++++++++++++++++++++++++++
-
- >From jrb@mitre.org (Bob Boonstra)
- Date: Sun, 22 May 1994 07:37:29 -0500
- Organization: MITRE
-
- In article <2rjp0k$cqe@crl2.crl.com>, spencerl@crl.com (Spencer Low) wrote:
-
- > How do you detect whether 32-bit Addressing is enabled/disabled? Also,
- > how can you turn it on?
-
- mode = GetMMUMode(); /* returns false32b (0) or true32b (1) */
- SwapMMUMode(&mode); /* sets addressing mode and returns old mode */
- --
- -- Bob Boonstra
- -- jrb@mitre.org
- -- My opinion, not my employer's
-
- +++++++++++++++++++++++++++
-
- >From spencerl@crl.com (Spencer Low)
- Date: 22 May 1994 12:56:20 -0700
- Organization: LowTek Creations
-
- Bob Boonstra (jrb@mitre.org) wrote:
- > In article <2rjp0k$cqe@crl2.crl.com>, spencerl@crl.com (Spencer Low) wrote:
-
- > > How do you detect whether 32-bit Addressing is enabled/disabled? Also,
- > > how can you turn it on?
-
- > mode = GetMMUMode(); /* returns false32b (0) or true32b (1) */
- > SwapMMUMode(&mode); /* sets addressing mode and returns old mode */
-
- Is this the same 32-bit mode that the Memory control panel controls? I
- always thought that this was a different related thing. If there are
- these routines, why do we have to reboot after changing the mode in the
- Memory control panel?
-
- Thanks,
- Spencer
- --
- Spencer Low | Creators of MaxRAM!!
- LowTek Creations | Anonymous FTP to crl.com and look in
- spencerl@crl.com | /users/ro/spencerl/ for more info.
-
- +++++++++++++++++++++++++++
-
- >From jwbaxter@olympus.net (John W. Baxter)
- Date: Mon, 23 May 1994 07:47:10 -0700
- Organization: Internet for the Olympic Peninsula
-
- In article <2rodd4$99s@crl2.crl.com>, spencerl@crl.com (Spencer Low) wrote:
-
- > Bob Boonstra (jrb@mitre.org) wrote:
- > > In article <2rjp0k$cqe@crl2.crl.com>, spencerl@crl.com (Spencer Low) wrote:
- >
- > > > How do you detect whether 32-bit Addressing is enabled/disabled? Also,
- > > > how can you turn it on?
- >
- > > mode = GetMMUMode(); /* returns false32b (0) or true32b (1) */
- > > SwapMMUMode(&mode); /* sets addressing mode and returns old mode */
- >
- > Is this the same 32-bit mode that the Memory control panel controls? I
- > always thought that this was a different related thing. If there are
- > these routines, why do we have to reboot after changing the mode in the
- > Memory control panel?
-
- SwapMMUMode () is intended for *temporary* mode changes (such as the
- necessary switch to 32-bit mode to access video memory on typical cards).
- It does not magically change all the heaps in the machine between 24-bit
- form and 32-bit form (not to mention that there are now [at least] two
- variations of the 32-bit heap). [So...what you can do during the temporary
- switch is quite limited.]
-
- --
- John Baxter Port Ludlow, WA, USA [West shore, Puget Sound]
- jwbaxter@pt.olympus.net
-
- +++++++++++++++++++++++++++
-
- >From philip@cs.wits.ac.za (Philip Machanick)
- Date: Wed, 25 May 1994 07:32:57 +0200
- Organization: Computer Science Dept, U of Witwatersrand
-
- In article <2rodd4$99s@crl2.crl.com>, spencerl@crl.com (Spencer Low) wrote:
-
- > Is this the same 32-bit mode that the Memory control panel controls? I
- > always thought that this was a different related thing. If there are
- > these routines, why do we have to reboot after changing the mode in the
- > Memory control panel?
-
- Could it be that there's a difference between locally changing the mode for
- a little piece of your code (e.g., check if in 32-bit mode, if so switch it
- off for a piece of old code then switch it on again) and globally changing
- it for every piece of software on the system?
- --
- Philip Machanick philip@cs.wits.ac.za
- Department of Computer Science, University of the Witwatersrand
- 2050 Wits, South Africa
- phone 27(11)716-3309 fax 27(11)339-7965
-
- +++++++++++++++++++++++++++
-
- >From shirleyd@cognos.COM (Dieter Shirley)
- Date: Fri, 27 May 1994 17:27:04 GMT
- Organization: Cognos Incorporated, Ottawa CANADA
-
- Spencer Low (spencerl@crl.com) wrote:
- : Bob Boonstra (jrb@mitre.org) wrote:
- : > mode = GetMMUMode(); /* returns false32b (0) or true32b (1) */
- : > SwapMMUMode(&mode); /* sets addressing mode and returns old mode */
-
- : Is this the same 32-bit mode that the Memory control panel controls? I
- : always thought that this was a different related thing. If there are
- : these routines, why do we have to reboot after changing the mode in the
- : Memory control panel?
-
- All the traps and stuff are initialized at boot up to either work in
- 24-bit or 32-bit mode. If you swap it, you can do writes to upper
- (video and NuBus) memory, but if you call any traps during this time,
- they'll expect to be in the mode that the computer started in. If you're
- in a different mode, they could crash horrifically.
-
- If you need to know if 32-bit addressing is on, use the Gestalt call.
- If you need 32-bit addressing on for a *short* time use SwapMMUMode().
- If you need 32-bit addressing on for a long time (like, the whole
- course of your program) inform the user to turn it on via the control
- panel, and then quit. You could set the bit in PRAM yourself, but
- then they'd still have to restart.
-
- Good luck,
- -dete
-
- ---------------------------
-
- >From Stephan Bublava <stephan@iguwnext.tuwien.ac.at>
- Subject: AppleScript Questions
- Date: 14 May 1994 17:45:37 GMT
- Organization: Vienna University of Technology
-
- Hi, I have two questions regarding AppleScript:
-
- 1) Is there any way to allow/disallow user interaction?
-
- 2) Can I run a script asynchronously? I am playing around
- with OSA menu and whenever I activate a script the
- front application is blocked until the script is finished.
- I know that "ignoring application responses" works around
- this, but on the other hand, I need application responses
- for some scripts to work, and to get errors back.
-
- Any info would be appreciated.
-
- Stephan
-
- --
- Stephan Bublava
- stephan@iguwnext.tuwien.ac.at
-
- +++++++++++++++++++++++++++
-
- >From Jens Alfke <jens_alfke@powertalk.apple.com>
- Date: Wed, 25 May 1994 18:38:34 GMT
- Organization: Apple Computer
-
- Stephan Bublava, stephan@iguwnext.tuwien.ac.at writes:
- > 1) Is there any way to allow/disallow user interaction?
-
- I seem to remember that there is, but I can't remember the syntax. Check the
- manual...
-
- > 2) Can I run a script asynchronously? I am playing around
- > with OSA menu and whenever I activate a script the
- > front application is blocked until the script is finished.
- > I know that "ignoring application responses" works around
- > this, but on the other hand, I need application responses
- > for some scripts to work, and to get errors back.
-
- If you save a script as an application ("applet") it will run asynchronously
- in its own process. If you still want the ease-of-triggering of a menu
- command, you can either put the applet in the Apple menu (which will bring
- its layer to the front) or write a little launcher script for OSAMenu that
- just launches your applet.
-
- --Jens Alfke
- jens_alfke@powertalk Rebel girl, rebel girl,
- .apple.com Rebel girl you are the queen of my world
-
- +++++++++++++++++++++++++++
-
- >From Stephan Bublava <stephan@iguwnext.tuwien.ac.at>
- Date: 27 May 1994 12:17:14 GMT
- Organization: Vienna University of Technology
-
- In article <1994May25.183834.6893@gallant.apple.com> Jens Alfke,
- jens_alfke@powertalk.apple.com writes:
-
- >> 1) Is there any way to allow/disallow user interaction?
-
- >I seem to remember that there is, but I can't remember the
- >syntax. Check the manual...
-
- Well, that's what I did before posting, but it does not contain
- anything (I checked the manual for 1.0, and the release notes
- for both 1.0 and 1.1).
-
- Thanks for your information on my other question.
-
- In the meantime I have yet another problem: I can't get
- transactions to work.
-
- For example:
-
- tell application "FileMaker Pro"
- with transaction
- ...
- end transaction
- end tell
-
- The problem is "end transaction" because there also is
- a command with the same name. If you only write "end" then
- it will compile, but only once because AppleScript changes
- the line back to "end transaction".
-
- But apart from that, it didn't work right (with FileMaker Pro):
- In the transaction I created a new record and then searched
- for a record that did not exist. I expected that the record I
- had created would be automatically deleted again (since the
- search failed), but I just got an error message.
-
- Is this one of the many problems FileMaker has with AppleScript,
- or am I doing something wrong?
-
- Stephan
-
- --
- Stephan Bublava
- stephan@iguwnext.tuwien.ac.at
-
- +++++++++++++++++++++++++++
-
- >From hades@coos.dartmouth.edu (Brian V. Hughes)
- Date: 27 May 1994 15:52:27 GMT
- Organization: Dartmouth College, Hanover, NH, USA
-
- Stephan Bublava <stephan@iguwnext.tuwien.ac.at> writes:
-
- >In the meantime I have yet another problem: I can't get
- >transactions to work.
-
- >For example:
-
- >tell application "FileMaker Pro"
- > with transaction
- > ...
- > end transaction
- >end tell
-
- >The problem is "end transaction" because there also is
- >a command with the same name. If you only write "end" then
- >it will compile, but only once because AppleScript changes
- >the line back to "end transaction".
-
- I think what you need to do is use the "Begin Transation" and "End
- Transaction" AppleScript commands that are part of FM Pro's
- dictionary. I don't know how they differ from the with transaction
- control statement but my guess is that AppleEvents were added to FM Pro
- before the with transaction control statement was fully implimented, and
- therefore it doesn't support it correctly. That's why there are separate
- commands for it that are FM Pro specific.
-
- -Hades
-
- +++++++++++++++++++++++++++
-
- >From jonpugh@netcom.com (Jon Pugh)
- Date: Sun, 29 May 1994 06:36:13 GMT
- Organization: NETCOM On-line Communication Services (408 261-4700 guest)
-
- Jens Alfke (jens_alfke@powertalk.apple.com) wrote:
- > Stephan Bublava, stephan@iguwnext.tuwien.ac.at writes:
- > > 1) Is there any way to allow/disallow user interaction?
-
- > I seem to remember that there is, but I can't remember the syntax. Check the
- > manual...
-
- There are no user interaction events or settings in AppleScript. That's
- why programs will need to implement something similar to what I did in
- PhotoFlash. I created an application property called "user iteraction"
- which takes a set of enums; none, interact with local, interact with remote,
- & interact with all. Then before you put up any dialog, call a CanDoUI
- routine which checks the UI level and calls AEInteractWithUser if it is not
- none (since the AEM doesn't include a none setting). This ensures that you
- get brought to the front and/or a notification is posted. You need to
- implement none because the AEM's minimum is "interact with local" and if you
- run a script (via a script menu or so) your script is local and allowed to
- interact. Yuck. You need to use a global to get the never interact level
- and you need to provide defaults for every function that calls CanDoUI and
- gets back a false.
-
- I would suggest that a future version of AppleScript and the AEM support
- this feature, if there anyone working on either. ;)
-
- Jon
-
-
- +++++++++++++++++++++++++++
-
- >From jwbaxter@olympus.net (John W. Baxter)
- Date: Sun, 29 May 1994 08:25:58 -0700
- Organization: Internet for the Olympic Peninsula
-
- In article <jonpughCqJx0D.IE3@netcom.com>, jonpugh@netcom.com (Jon Pugh)
- wrote:
-
- > There are no user interaction events or settings in AppleScript. That's
- > why programs will need to implement something similar to what I did in
- > PhotoFlash. I created an application property called "user iteraction"
- > which takes a set of enums; none, interact with local, interact with remote,
- > & interact with all. Then before you put up any dialog, call a CanDoUI
- > routine which checks the UI level and calls AEInteractWithUser if it is not
- > none (since the AEM doesn't include a none setting). This ensures that you
- > get brought to the front and/or a notification is posted. You need to
- > implement none because the AEM's minimum is "interact with local" and if you
- > run a script (via a script menu or so) your script is local and allowed to
- > interact. Yuck. You need to use a global to get the never interact level
- > and you need to provide defaults for every function that calls CanDoUI and
- > gets back a false.
-
- Jon...The AE Manager is quite happy with "never interact" as sent by the
- sender. It is of course true that the client side's minimum level for
- AESetInteractionAllowed () is self (which I think I consider "lower" than
- local, since it cuts out other clients). So you are right that to achieve
- never, the application has to remember that it shouldn't interact.
-
- > I would suggest that a future version of AppleScript and the AEM support
- > this feature, if there anyone working on either. ;)
-
- I found it surprising that AppleScript elected to use only "can" interact.
- Frontier, on the other hand, can currently be set to send either "never" or
- "always" (version 2 was "never" or "can"...the change to "always" has
- caused some scripting glitches with FileMaker, which now must be brought to
- the front before certain actions are sent from Frontier).
-
- So an OSA Menu script which needs to be never interact could be written in
- UserTalk, with the level being set to never [the UserTalk for that is
- setEventInteraction (false)...the setting is per-script].
-
- I concur that AppleScript should be enhanced to permit per-script settings
- of "never", "can", and "always" (and control might be desired for the
- kAECanSwitchLayer flag, too).
-
- Good job with your PhotoFlash workaround...I'll have to remember to
- implement (ie, steal) that idea.
- --
- John Baxter Port Ludlow, WA, USA [West shore, Puget Sound]
- jwbaxter@pt.olympus.net
-
- ---------------------------
-
- >From eshieh@po.EECS.Berkeley.EDU (Eric Shieh)
- Subject: Code Warrior allocation of Objects
- Date: 22 May 1994 20:54:17 GMT
- Organization: University of California, Berkeley
-
- Just received CW Gold DR/2 2 weeks ago and have ported my program
- from Think C 5.0 to it...seems to work great except that the CW
- compiler is a lot pickier about types...anyways, that's OK.
-
- The bulk of my program is in standard C. Now, I'm trying to add some
- stuff using C++. The problem: once I allocate an object via 'new' (i haven't
- tryied allocating it on the stack), about 80K is allocated in the heap...
- Now, this may be OK in a 2-3 meg program, but since my program's total
- file size is 68K in a 120K partition, 80K is a big deal...
-
- Oh, and if I call delete, the 80K remains in the heap, non-relocatable. but
- calling new again doesn't try to allocate another 80K....
-
- So, my question is: Is this just the way it works or is this a bug? It seems
- rather odd that it's allocating so much memory since as I said, my
- program size is 68K, what could it be sticking in that 80K block?
-
- Oh, btw, is their any way to create objects as Handles instead of Pointers?
-
- And I also recall a codewarrior mailing list around here, anyone know the
- address/instructions?
-
- Thanks for listening,
- Eric
-
- eshieh@cory.berkeley.edu
-
-
- +++++++++++++++++++++++++++
-
- >From scouten@maroon.tc.umn.edu (Eric Scouten)
- Date: Mon, 23 May 1994 13:31:56 GMT
- Organization: University of Minnesota, Student Affairs
-
- In article <2rogpp$3j1@agate.berkeley.edu>, eshieh@po.EECS.Berkeley.EDU
- (Eric Shieh) wrote:
-
- > The bulk of my program is in standard C. Now, I'm trying to add some
- > stuff using C++. The problem: once I allocate an object via 'new' (i haven't
- > tryied allocating it on the stack), about 80K is allocated in the heap...
-
- CodeWarrior's operator new bypasses the Memory Manager when allocating
- small objects. It allocates its own pool of (apparently) 80K for any
- objects that are below a certain threshold size (4K I think?). This pool
- remains permanently allocated until the app quits; if it fills, CW grabs
- another 80K pool to create the next set of objects.
-
- The advantage of this is that the operator new/delete pair can manage
- objects more efficiently (both in memory and speed) than can the Memory
- Manager.
-
-
- > Oh, btw, is their any way to create objects as Handles instead of Pointers?
-
- Not in any compiler that supports multiple inheritance. (At least SC++ 7.0
- and CodeWarrior don't support handle objects.) Handles are an ugly way to
- manage objects anyway: accessing member fields is considerably less
- efficient, and you have to be much more careful about how you use pointers.
-
-
- > And I also recall a codewarrior mailing list around here, anyone know the
- > address/instructions?
-
- Yup. To subscribe send a one line message...
-
- subscribe cwarrior <Your name in real life, not e-mail address>
-
- ... to the address listserv@netcom.com. Make sure your signature is turned
- off.
-
- -Eric
-
-
- --
- Eric Scouten * Univ of Minnesota * Student Affairs * +1 612 626 0746
- ** MS Computer Science student, Univ of Illinois, starting Aug '94 **
-
- WYSIWIG: What You See Is What You Get
-
- WYSIWOBBLE: What You See Isn't What's Output By the Blasted Laserwriter Eh?
-
- +++++++++++++++++++++++++++
-
- >From partingt@fwi.uva.nl (Vincent Partington)
- Date: 24 May 1994 11:58:59 GMT
- Organization: FWI, University of Amsterdam
-
- eshieh@po.EECS.Berkeley.EDU (Eric Shieh) writes:
-
- >The bulk of my program is in standard C. Now, I'm trying to add some
- >stuff using C++. The problem: once I allocate an object via 'new' (i haven't
- >tryied allocating it on the stack), about 80K is allocated in the heap...
- >Now, this may be OK in a 2-3 meg program, but since my program's total
- >file size is 68K in a 120K partition, 80K is a big deal...
-
- This is because new and delete use their own allocator system that gets
- chunks of OS-memory at once to efficiently manage memory.
- You can bypass this be recompiling the C++ Runtime library: the source-
- code for new/delete is in the C++ Runtime directory, there's a define that
- you can change to make new/delete use NewPtr/DisposePtr, just have
- a look at the code in the New.cp and NewMore.cp files.
-
- Vincent.
- --
- My opinions are not my own. I copy them | Internet : partingt@fwi.uva.nl
- from books, television, video, the net, | vincent@tnc.nl
- my friends, my parents, my teachers and | FidoNet : 2:281/202.15
- and numerous other contributors. | NeST : 90:500/202.15
-
- +++++++++++++++++++++++++++
-
- >From Jens Alfke <jens_alfke@powertalk.apple.com>
- Date: Wed, 25 May 1994 19:15:42 GMT
- Organization: Apple Computer
-
- In article <2rsq63$h0k@hermes.fwi.uva.nl> Vincent Partington,
- partingt@fwi.uva.nl writes:
- > This is because new and delete use their own allocator system that gets
- > chunks of OS-memory at once to efficiently manage memory.
- > You can bypass this be recompiling the C++ Runtime library...
-
- Naw, just add an 'operator new' and 'operator delete' in the base class and
- have it use some other allocation scheme. NewPtr will work okay but will be
- lots slower if tons of objects are being created and deleted. If the program
- is already using some more efficient memory allocator (malloc or something)
- then you can use that.
-
- --Jens Alfke
- jens_alfke@powertalk Rebel girl, rebel girl,
- .apple.com Rebel girl you are the queen of my world
-
- +++++++++++++++++++++++++++
-
- >From partingt@fwi.uva.nl (Vincent Partington)
- Date: 26 May 1994 10:47:10 GMT
- Organization: FWI, University of Amsterdam
-
- Jens Alfke <jens_alfke@powertalk.apple.com> writes:
-
- >> This is because new and delete use their own allocator system that gets
- >> chunks of OS-memory at once to efficiently manage memory.
- >> You can bypass this be recompiling the C++ Runtime library...
-
- >Naw, just add an 'operator new' and 'operator delete' in the base class and
- >have it use some other allocation scheme. NewPtr will work okay but will be
- >lots slower if tons of objects are being created and deleted. If the program
- >is already using some more efficient memory allocator (malloc or something)
- >then you can use that.
-
- When adding those operators to "the" base class you have to change your C++
- code and derive all your classes from that class. Changing the C++ Runtime lib
- is admittedly dirtier but doesn't require changing the C++ code.
- Changing the C++ Runtime lib also allows you to change the allocation routines
- for arrays becuase AFAIK you can't change operator new/delete for arrays.
-
- Vincent\n
- --
- My opinions are not my own. I copy them | Internet : partingt@fwi.uva.nl
- from books, television, video, the net, | vincent@tnc.nl
- my friends, my parents, my teachers and | FidoNet : 2:281/202.15
- and numerous other contributors. | NeST : 90:500/202.15
-
- +++++++++++++++++++++++++++
-
- >From Jens Alfke <jens_alfke@powertalk.apple.com>
- Date: Fri, 27 May 1994 20:04:20 GMT
- Organization: Apple Computer
-
- Vincent Partington, partingt@fwi.uva.nl writes:
- > When adding those operators to "the" base class you have to change your C++
- > code and derive all your classes from that class. Changing the C++ Runtime
- lib
- > is admittedly dirtier but doesn't require changing the C++ code.
-
- That's a fair point; but you can always just define your own global operator
- new and operator delete, and then include the C++ runtime library without its
- operator new support. (I think there is a version of the library without
- operator new in it.) All of your classes will use the global operator
- new/delete by default.
-
- I'm always leery of modifying system libraries, since they generally change
- in every release and then I have to redo my work all over again.
-
- --Jens Alfke
- jens_alfke@powertalk Rebel girl, rebel girl,
- .apple.com Rebel girl you are the queen of my world
-
- ---------------------------
-
- >From amanda@intercon.com (Amanda Walker)
- Subject: Code Warrior: ruminations of a long-time MPW user
- Date: Tue, 24 May 1994 11:47:08 -0500
- Organization: InterCon Systems Corporation, Herndon, VA USA
-
- Several people have expressed surprise at my couple of posts supporting Code
- Warrior yesterday, since I've been a die-hard MPW user for years. I thought
- I'd go into some more detail on this, since the issues involved are not unique
- to me alone.
-
- I've been using MPW since version 2. I've also used just about every other C
- compiler to come out for the Mac, from the Megamax C and Consulair C to THINK
- C 7.0. All of these systems have their good points and their bad points.
- However, for multi-project multi-person development, MPW has held the lead.
- It is no speed demon in terms of lines per minute compiled, but it is
- extremely flexible. The abilities to script the environment, provide multi-
- user source code and revision control, and add custom tools serve to make up
- in the long term for a lack of compilation speed. Also, Apple generally
- releases new technology via MPW header files and/or libraries, which can be
- especially important when dealing with pre-release versions of Apple software
- (as I have been a number of times). All of these things have kept me in the
- MPW camp for the kind of work I do most. Symantec C 6.0 looked promising,
- since it was finally scriptable, but the bugs in it and the general manner in
- which Symantec has handled 6.x and 7.0 have undermined my faith in their
- ability to deliver a quality product, despite having used it off and on since
- it was called "Lightspeed C".
-
- I'd seen a preview of Code Warrior in December at one of Apple's "PowerPC
- Coding Kitchens" which they ran for developers in the seeding program. It
- looked promising, but it was still kind of buggy, and was not scriptable. The
- person doing the demo characterized it as analogous to THINK C 5.x for the
- PowerPC. As a result, I sighed and went back to the Apple RISC SDK, which I
- fought with for some time before finally getting a build that I felt
- comfortable saying we could ship to customers. However, by this time I was
- getting aggravated at MPW as well. The PowerPC C compilers and linker in
- Apple's SDK are excruciatingly slow, and the optimizer breaks. TCP/Connect II
- 1.2.1 is built with optimization off to avoid compiler bus errors and bad code
- generation. It also doesn't run native, making the 8100/80 on my desk almost
- usefuless for anything but testing.
-
- It has not been a fun spring in some respects.
-
- By the WWDC, Code Warrior had started to get rave reviews, both here and from
- other developers whose opinions I have learned to respect, so I went with an
- open mind. After watching the Metrowerks presentation, and sitting down with
- Code Warrior myself, I became convinced that they really did know what they
- were doing. It was fast, native, and had an optimizer that seems to actually
- work. It's scriptable, so that I can do a large multi-project build without
- having to hand-drive the process. It coexists nicely with SourceServer, so
- that I can continue to use existing source code databases. It's code
- generator isn't a mangled version of an 8x86 code generator, so it actually
- generates nice code. I don't have to hook my PowerBook up to my Power Mac
- just to run the debugger. It's not perfect, but it finally tipped the scale
- compared to MPW. MPW tool versions of the compilers and linkers, which
- Metrowerks says are in the pipeline, will be the final clincher, since they
- will give me the best of both worlds.
-
- Besides, Metrowerks seems to be as much a bunch of crazy workaholics as
- InterCon is :).
-
-
- Amanda Walker
- Advanced Projects
- InterCon Systems Corporation
-
-
-
- +++++++++++++++++++++++++++
-
- >From mikel@intercon.com (Michael W. Wellman)
- Date: Tue, 24 May 1994 14:30:57 -0500
- Organization: InterCon Systems Corp., Herndon, VA, USA
-
- amanda@intercon.com (Amanda Walker) writes:
- > However, by this time I was getting aggravated at MPW as well.
- > The PowerPC C compilers and linker in Apple's SDK are excruciatingly
- > slow, and the optimizer breaks. TCP/Connect II 1.2.1 is built with
- > optimization off to avoid compiler bus errors and bad code generation.
- > It also doesn't run native, making the 8100/80 on my desk almost
- > usefuless for anything but testing.
-
- Er, I'd just like to make it clear that the "It" above refers to MPW and not
- TCP/Connect II 1.2.1. The latter works quite nicely natively...
-
- Now if only Metrowerks and Apple's Open Transport would work out their
- differences regards Apple's Shared Library Manager.
-
- mikel
-
-
-
-
-
- +++++++++++++++++++++++++++
-
- >From peirce@outpost.SF-Bay.org (Michael Peirce)
- Date: Tue, 24 May 94 14:30:05 PST
- Organization: Peirce Software, Inc.
-
-
- In article <9405241430.AA57204@mikel.intercon.com> (comp.sys.mac.programmer), mikel@intercon.com (Michael W. Wellman) writes:
- > amanda@intercon.com (Amanda Walker) writes:
- > > However, by this time I was getting aggravated at MPW as well.
- > > The PowerPC C compilers and linker in Apple's SDK are excruciatingly
- > > slow, and the optimizer breaks. TCP/Connect II 1.2.1 is built with
- > > optimization off to avoid compiler bus errors and bad code generation.
- > > It also doesn't run native, making the 8100/80 on my desk almost
- > > usefuless for anything but testing.
- >
- > Er, I'd just like to make it clear that the "It" above refers to MPW and not
- > TCP/Connect II 1.2.1. The latter works quite nicely natively...
-
- The "prerelease MPW" version 3.4a2 from E.T.O. 14 has some native
- parts in it now.
-
- The shell is native, as is make, rez, derez, and rezdet. Too bad
- Link and C aren't native, but the native shell (and my faster hard
- disk) make for a quicker startup. And the Make doesn't take any time
- anymore either.
-
- It's only a start, but at least its better than nothing.
-
- (I'm very much looking forward to trying the CodeWarrior compiler
- and linker under MPW!)
-
- __ Michael Peirce __ peirce@outpost.sf-bay.org
- __ Peirce Software, Inc. __ 719 Hibiscus Place, Suite 301
- __ __ San Jose, California USA 95117-1844
- __ Makers of: Smoothie & __ voice: +1.408.244.6554 fax: +1.408.244.6882
- __ Peirce Print Tools __ AppleLink: peirce & AOL: AFC Peirce
-
- +++++++++++++++++++++++++++
-
- >From songer@ovation.lexmark.com (Christopher Songer)
- Date: Wed, 25 May 1994 13:50:40 GMT
- Organization: Lexmark International, Lexington, KY
-
- In article <9405241147.AA08906@fusion.intercon.com> amanda@intercon.com (Amanda Walker) writes:
-
- [...]
- By the WWDC, Code Warrior had started to get rave reviews, both here and from
- other developers whose opinions I have learned to respect, so I went with an
- open mind.
- [...]
-
- Hi!
-
- Thanks for the review -- it is much appreciated and was quite
- informative. Can you speak to the source control management provided
- by the CodeWarrior package?
-
- Thanks!
- -Chris
- songer@lexmark.com
-
- +++++++++++++++++++++++++++
-
- >From amanda@intercon.com (Amanda Walker)
- Date: Wed, 25 May 1994 17:35:41 -0400
- Organization: InterCon Systems Corporation, Herndon, VA USA
-
- mikel@intercon.com (Michael W. Wellman) writes:
- > Er, I'd just like to make it clear that the "It" above refers to MPW
- > and not TCP/Connect II 1.2.1. The latter works quite nicely natively...
-
- Yes, indeed. I used it to post that article, in fact :).
-
-
- Amanda Walker
- InterCon Systems Corporation
-
-
-
- +++++++++++++++++++++++++++
-
- >From jpurlia@qualcomm.com (John Purlia)
- Date: Thu, 26 May 1994 13:17:22 -0800
- Organization: Qualcomm, Inc.
-
- In article <9405241147.AA08906@fusion.intercon.com> amanda@intercon.com
- (Amanda Walker) writes:
- >[...]
- >By the WWDC, Code Warrior had started to get rave reviews, both here and from
- >other developers whose opinions I have learned to respect, so I went with an
- >open mind.
- >[...]
-
- Yes, a very large number of Apple engineers are using and raving about Code
- Warrior which is encouraging when evaluating the stability and usefulness
- of a new development environment. I'd very much prefer to use the power
- available to me through the MPW environment so I'm eagerly awaiting the
- release of native MPW tools from MetroWerks -- especially after talking to
- a couple of people at the MPW station at the conference expo who
- regrettably informed me that there are no plans for porting a 68K compiler
- to run native on PPC, which means... writing fat binaries will require you
- to compile the 68K portion of your app with an emulated compiler! AARGH!!!
- ...........................................................................
- John Purlia : My brain; not my company's brain. My brain says...
- jpurlia@qualcomm.com :
- Applelink AM0470 : "Newton could never live on Via de la Valle,
- NewtonMail: JPurlia : but it would be right at home on Cruel Lucille"
-
- +++++++++++++++++++++++++++
-
- >From amanda@intercon.com (Amanda Walker)
- Date: Fri, 27 May 1994 12:27:38 -0500
- Organization: InterCon Systems Corporation, Herndon, VA USA
-
- songer@ovation.lexmark.com (Christopher Songer) writes:
- > Thanks for the review -- it is much appreciated and was quite
- > informative. Can you speak to the source control management provided
- > by the CodeWarrior package?
-
- Currently, it is Projector-aware, so we're continuing to use SourceServer from
- MPW. Code Warrior does not have its own source code control system.
-
-
- Amanda Walker
- InterCon Systems Corporation
-
-
-
- ---------------------------
-
- >From nathan@cse.ucsc.edu (Nathan J. Wilson)
- Subject: Refinement of SC++ 7.0 code gen bug
- Date: 27 May 1994 06:34:38 GMT
- Organization: UC Santa Cruz CIS/CE
-
- First, I must say that I have been pleased with the response to my
- original posting (Thanks Tom and Phil!). I managed to reduce the
- bug to a small stand alone example. I have already send this to
- Symantec directly, but I thought I should post it here so other's
- could know what to watch out for until a fix is available. The
- causes appears to be with assign in the results of virtual
- member function that returns a double directly to a member of
- another class (or struct) within a loop. The effect is that some
- unpreserved registers get trashed resulting in garbage. Work around
- is to assign the result to a temporary.
-
- -Nathan
-
- // main.cpp
-
- // Demonstration of a code generation bug in Symantec C++ 7.0
- // Output should be:
- // 12.34 == <garbage float>
- //
- // If you set BUG to 0 then you get the correct output which should be
- // 12.34 == 12.34
- //
-
- #define BUG 1
-
- #include <stdio.h>
-
- #define THE_TYPE double // Must be double, float works fine
-
- class FeatureNum {
- public:
- THE_TYPE num; // Destination must be a member of a class or struct
- };
-
- class Foo {
- public:
- virtual THE_TYPE Eval() { return 12.34; }; // Function must be a virtual member function
- };
-
- int main()
- {
- Foo *foo = new Foo(); // Must be pointer to an object. Can't use Foo foo;
- FeatureNum table2[1];
- long i = 0;
- while (i < 1) { // Must have loop
- #if BUG
- table2[i].num = foo->Eval(); // Obviously, assignment must be direct
- #else
- THE_TYPE tmp = foo->Eval();
- table2[i].num = tmp;
- #endif
- printf("%lg == %lg\n", foo->Eval(), table2[i].num);
- i++;
- }
- delete foo;
- return 0;
- }
-
- #ifdef NEVER
-
- Here is the disassembled buggy code:
-
- main:
- 00000000: 4E56 FFDC LINK A6,#$FFDC
- 00000004: 48E7 1838 MOVEM.L D3/D4/A2-A4,-(A7)
- 00000008: 7004 MOVEQ #$04,D0
- 0000000A: 2F00 MOVE.L D0,-(A7)
- 0000000C: 4EBA 0000 JSR operator new(unsigned int)
- 00000010: 2840 MOVEA.L D0,A4
- 00000012: 4A80 TST.L D0
- 00000014: 670C BEQ.S *+$000E ; 00000022
- 00000016: 2D40 FFE8 MOVE.L D0,$FFE8(A6)
- 0000001A: 41ED 0000 LEA Foo::_vtbl,A0
- 0000001E: 2240 MOVEA.L D0,A1
- 00000020: 2288 MOVE.L A0,(A1)
- 00000022: 200C MOVE.L A4,D0
- 00000024: 2640 MOVEA.L D0,A3
- 00000026: 7000 MOVEQ #$00,D0
- 00000028: 2800 MOVE.L D0,D4
- 0000002A: 0C84 0000 0001 CMPI.L #$00000001,D4
- 00000030: 6C00 0096 BGE *+$0098 ; 000000C8
- 00000034: 2F0B MOVE.L A3,-(A7)
- 00000036: 204B MOVEA.L A3,A0
- 00000038: 2250 MOVEA.L (A0),A1
- 0000003A: 2251 MOVEA.L (A1),A1
- 0000003C: 4E91 JSR (A1)
- 0000003E: 2604 MOVE.L D4,D3
- 00000040: 2003 MOVE.L D3,D0
- 00000042: C6FC 000A MULU.W #$000A,D3
- 00000046: 4840 SWAP D0
- 00000048: C0FC 000A MULU.W #$000A,D0
- 0000004C: 4840 SWAP D0
- 0000004E: 4240 CLR.W D0
- 00000050: D680 ADD.L D0,D3
- 00000052: 45EE FFDC LEA $FFDC(A6),A2
- 00000056: 3580 3000 MOVE.W D0,$00(A2,D3.W)
- 0000005A: 2581 3002 MOVE.L D1,$02(A2,D3.W)
- 0000005E: 2588 3006 MOVE.L A0,$06(A2,D3.W)
- 00000062: 2004 MOVE.L D4,D0
- 00000064: 2200 MOVE.L D0,D1
- 00000066: C0FC 000A MULU.W #$000A,D0
- 0000006A: 4841 SWAP D1
- 0000006C: C2FC 000A MULU.W #$000A,D1
- 00000070: 4841 SWAP D1
- 00000072: 4241 CLR.W D1
- 00000074: D081 ADD.L D1,D0
- 00000076: 2D72 0000 FFF6 MOVE.L $00(A2,D0.W),$FFF6(A6)
- 0000007C: 2D72 0004 FFFA MOVE.L $04(A2,D0.W),$FFFA(A6)
- 00000082: 3D72 0008 FFFE MOVE.W $08(A2,D0.W),$FFFE(A6)
- 00000088: 2F2E FFFC MOVE.L $FFFC(A6),-(A7)
- 0000008C: 2F2E FFF8 MOVE.L $FFF8(A6),-(A7)
- 00000090: 3F2E FFF6 MOVE.W $FFF6(A6),-(A7)
- 00000094: 2F0B MOVE.L A3,-(A7)
- 00000096: 204B MOVEA.L A3,A0
- 00000098: 2050 MOVEA.L (A0),A0
- 0000009A: 2050 MOVEA.L (A0),A0
- 0000009C: 4E90 JSR (A0)
- 0000009E: 3D40 FFEC MOVE.W D0,$FFEC(A6)
- 000000A2: 2D41 FFEE MOVE.L D1,$FFEE(A6)
- 000000A6: 2D48 FFF2 MOVE.L A0,$FFF2(A6)
- 000000AA: 2F2E FFF2 MOVE.L $FFF2(A6),-(A7)
- 000000AE: 2F2E FFEE MOVE.L $FFEE(A6),-(A7)
- 000000B2: 3F2E FFEC MOVE.W $FFEC(A6),-(A7)
- 000000B6: 486D 0000 PEA $0000(A5)
- 000000BA: 4EBA 0000 JSR printf
- 000000BE: 4FEF 0018 LEA $0018(A7),A7
- 000000C2: 5284 ADDQ.L #$1,D4
- 000000C4: 6000 FF64 BRA *-$009A ; 0000002A
- 000000C8: 2F0B MOVE.L A3,-(A7)
- 000000CA: 4EBA 0000 JSR operator delete(void *)
- 000000CE: 7000 MOVEQ #$00,D0
- 000000D0: 4CDF 1C18 MOVEM.L (A7)+,D3/D4/A2-A4
- 000000D4: 4E5E UNLK A6
- 000000D6: 4E75 RTS
- 000000D8
-
- Foo::Eval(void):
- 00000000: 4E56 FFF4 LINK A6,#$FFF4
- 00000004: 2D7C 4002 C570 MOVE.L #$4002C570,$FFF6(A6)
- FFF6
- 0000000C: 2D7C A3D7 0A3D MOVE.L #$A3D70A3D,$FFFA(A6)
- FFFA
- 00000014: 3D7C 7000 FFFE MOVE.W #$7000,$FFFE(A6)
- 0000001A: 302E FFF6 MOVE.W $FFF6(A6),D0
- 0000001E: 222E FFF8 MOVE.L $FFF8(A6),D1
- 00000022: 206E FFFC MOVEA.L $FFFC(A6),A0
- 00000026: 4E5E UNLK A6
- 00000028: 225F MOVEA.L (A7)+,A1
- 0000002A: 584F ADDQ.W #$4,A7
- 0000002C: 4ED1 JMP (A1)
- 0000002E
-
- Here is the disassembled non-buggy code. Changes are commented:
-
- main:
- 00000000: 4E56 FFD0 LINK A6,#$FFD0
- 00000004: 48E7 1838 MOVEM.L D3/D4/A2-A4,-(A7)
- 00000008: 7004 MOVEQ #$04,D0
- 0000000A: 2F00 MOVE.L D0,-(A7)
- 0000000C: 4EBA 0000 JSR operator new(unsigned int)
- 00000010: 2840 MOVEA.L D0,A4
- 00000012: 4A80 TST.L D0
- 00000014: 670C BEQ.S *+$000E ; 00000022
- 00000016: 2D40 FFE8 MOVE.L D0,$FFE8(A6)
- 0000001A: 41ED 0000 LEA Foo::_vtbl,A0
- 0000001E: 2240 MOVEA.L D0,A1
- 00000020: 2288 MOVE.L A0,(A1)
- 00000022: 200C MOVE.L A4,D0
- 00000024: 2640 MOVEA.L D0,A3
- 00000026: 7000 MOVEQ #$00,D0
- 00000028: 2800 MOVE.L D0,D4
- 0000002A: 0C84 0000 0001 CMPI.L #$00000001,D4
- 00000030: 6C00 00A8 BGE *+$00AA ; 000000DA
- 00000034: 2F0B MOVE.L A3,-(A7)
- 00000036: 204B MOVEA.L A3,A0
- 00000038: 2250 MOVEA.L (A0),A1
- 0000003A: 2251 MOVEA.L (A1),A1
- 0000003C: 4E91 JSR (A1)
- 0000003E: 3D40 FFDC MOVE.W D0,$FFDC(A6) ; Added
- 00000042: 2D41 FFDE MOVE.L D1,$FFDE(A6) ; Added
- 00000046: 2D48 FFE2 MOVE.L A0,$FFE2(A6) ; Added
- 0000004A: 2604 MOVE.L D4,D3
- 0000004C: 2003 MOVE.L D3,D0
- 0000004E: C6FC 000A MULU.W #$000A,D3
- 00000052: 4840 SWAP D0
- 00000054: C0FC 000A MULU.W #$000A,D0
- 00000058: 4840 SWAP D0
- 0000005A: 4240 CLR.W D0
- 0000005C: D680 ADD.L D0,D3
- 0000005E: 45EE FFD0 LEA $FFD0(A6),A2
- 00000062: 25AE FFDC 3000 MOVE.L $FFDC(A6),$00(A2,D3.W) ; Change
- 00000068: 25AE FFE0 3004 MOVE.L $FFE0(A6),$04(A2,D3.W) ; Change
- 0000006E: 35AE FFE4 3008 MOVE.W $FFE4(A6),$08(A2,D3.W) ; Change
- 00000074: 2004 MOVE.L D4,D0
- 00000076: 2200 MOVE.L D0,D1
- 00000078: C0FC 000A MULU.W #$000A,D0
- 0000007C: 4841 SWAP D1
- 0000007E: C2FC 000A MULU.W #$000A,D1
- 00000082: 4841 SWAP D1
- 00000084: 4241 CLR.W D1
- 00000086: D081 ADD.L D1,D0
- 00000088: 2D72 0000 FFF6 MOVE.L $00(A2,D0.W),$FFF6(A6)
- 0000008E: 2D72 0004 FFFA MOVE.L $04(A2,D0.W),$FFFA(A6)
- 00000094: 3D72 0008 FFFE MOVE.W $08(A2,D0.W),$FFFE(A6)
- 0000009A: 2F2E FFFC MOVE.L $FFFC(A6),-(A7)
- 0000009E: 2F2E FFF8 MOVE.L $FFF8(A6),-(A7)
- 000000A2: 3F2E FFF6 MOVE.W $FFF6(A6),-(A7)
- 000000A6: 2F0B MOVE.L A3,-(A7)
- 000000A8: 204B MOVEA.L A3,A0
- 000000AA: 2050 MOVEA.L (A0),A0
- 000000AC: 2050 MOVEA.L (A0),A0
- 000000AE: 4E90 JSR (A0)
- 000000B0: 3D40 FFEC MOVE.W D0,$FFEC(A6)
- 000000B4: 2D41 FFEE MOVE.L D1,$FFEE(A6)
- 000000B8: 2D48 FFF2 MOVE.L A0,$FFF2(A6)
- 000000BC: 2F2E FFF2 MOVE.L $FFF2(A6),-(A7)
- 000000C0: 2F2E FFEE MOVE.L $FFEE(A6),-(A7)
- 000000C4: 3F2E FFEC MOVE.W $FFEC(A6),-(A7)
- 000000C8: 486D 0000 PEA $0000(A5)
- 000000CC: 4EBA 0000 JSR printf
- 000000D0: 4FEF 0018 LEA $0018(A7),A7
- 000000D4: 5284 ADDQ.L #$1,D4
- 000000D6: 6000 FF52 BRA *-$00AC ; 0000002A
- 000000DA: 2F0B MOVE.L A3,-(A7)
- 000000DC: 4EBA 0000 JSR operator delete(void *)
- 000000E0: 7000 MOVEQ #$00,D0
- 000000E2: 4CDF 1C18 MOVEM.L (A7)+,D3/D4/A2-A4
- 000000E6: 4E5E UNLK A6
- 000000E8: 4E75 RTS
- 000000EA
-
- Foo::Eval(void):
- 00000000: 4E56 FFF4 LINK A6,#$FFF4
- 00000004: 2D7C 4002 C570 MOVE.L #$4002C570,$FFF6(A6)
- FFF6
- 0000000C: 2D7C A3D7 0A3D MOVE.L #$A3D70A3D,$FFFA(A6)
- FFFA
- 00000014: 3D7C 7000 FFFE MOVE.W #$7000,$FFFE(A6)
- 0000001A: 302E FFF6 MOVE.W $FFF6(A6),D0
- 0000001E: 222E FFF8 MOVE.L $FFF8(A6),D1
- 00000022: 206E FFFC MOVEA.L $FFFC(A6),A0
- 00000026: 4E5E UNLK A6
- 00000028: 225F MOVEA.L (A7)+,A1
- 0000002A: 584F ADDQ.W #$4,A7
- 0000002C: 4ED1 JMP (A1)
- 0000002E
-
- Finally, here is a text version of the project file used to compile the code:
- Wombat:Apps:ThinkC/C++:Play:Play.9
- 1 segments
- 3 files
-
- Segment 3
- Name:
- Preload: false
- Protected: true
- Locked: true
- Purgeable: true
- SystemHeap: false
- 3 files:
- Wombat:Apps:ThinkC/C++:SC++7.0:Standard Libraries:ANSI++
- Wombat:Apps:ThinkC/C++:SC++7.0:Standard Libraries:CPlusLib
- Wombat:Apps:ThinkC/C++:Play:main.cpp
-
- #endif
-
-
- ---------------------------
-
- >From fever@winternet.com (Fever)
- Subject: Serial Port Programming?
- Date: 26 May 1994 20:45:00 GMT
- Organization: StarNet Communications, Inc
-
- Could someone direct me to where I can find information on programming the
- Mac's serial ports? (Specifically: For modems, in C)
-
- I'd appreciate any information...
-
-
-
- +++++++++++++++++++++++++++
-
- >From d88-jwa@dront.nada.kth.se (Jon Wdtte)
- Date: 27 May 1994 06:48:46 GMT
- Organization: The Royal Institute of Technology
-
- In <2s31oc$16d@blackice.winternet.com> fever@winternet.com (Fever) writes:
-
- >Could someone direct me to where I can find information on programming the
- >Mac's serial ports? (Specifically: For modems, in C)
-
- The comp.sys.mac.programmer FAQ answer sheet shows, in code, how
- to make a list of all available serial ports, and then go on to
- use it for something. You can also check Think Reference 2.0.
-
- nada.kth.se:pub/hacks/mac-faq
-
- Cheers,
-
- / h+
-
- --
- -- Jon W{tte, h+@nada.kth.se, Mac Software Engineer Deluxe --
- "After I first used the Mac, I had a dream in which I would walk up to
- people, touch them, and they'd turn black. Then I could talk to them."
- -- Anon
-
- +++++++++++++++++++++++++++
-
- >From egurney@vcd.hp.com (Eddy J. Gurney)
- Date: Sat, 28 May 1994 00:49:06 GMT
- Organization: Hewlett-Packard VCD
-
- Fever (fever@winternet.com) wrote:
- >Could someone direct me to where I can find information on programming the
- >Mac's serial ports? (Specifically: For modems, in C)
-
- Check out the sample code on ftp.apple.com in:
-
- /dts/mac/sc/snippets/devices/pbxxx-serial-demo.hqx
-
- It is a good example of using the Mac serial ports "correctly".
-
- --
- Eddy J. Gurney N8FPW Hewlett-Packard Company, Vancouver (USA!) Division
- egurney@vcd.hp.com #include <standard-disclaimer.h>
- "Failures are divided into two classes-- those who thought and never did,
- and those who did and never thought." John Charles Salak
-
- ---------------------------
-
- >From sfkaplan@alife.santafe.edu (Scott Kaplan)
- Subject: Serial port use
- Date: 24 May 1994 19:59:57 GMT
- Organization: The Santa Fe Institute
-
- Hi there. I'm writing a quick little program which needs to make use of the
- serial ports (specifically, the modem port attached to, of all things, a
- modem...).
- For what this program is doing, it does not seem worth my time to figure out
- how to use the Comm Toolbox, so I thought I'd do it directly by opening the
- serial drivers and using good ol' FSRead and FSWrite. I'm having trouble,
- and I was hoping someone could tell me why.
-
- Here's the problem. I've go to do an FSRead on the modem port. If there is
- something waiting in the modem port's buffer, everything's great. However,
- if there is nothing there (nothing has come in since I read from it last),
- I die. Rather than returning a count of 0 bytes read in, and rather than
- returning some error value from FSRead, the machine crashes completely. I
- have to reboot. So, I am clearly doing something wrong here...
-
- If someone knows what this might be, please let me know. If more information
- about what I'm doing is needed, please ask, I'll be happy to provide it. and
- if you think that I shouldn't be avoiding the Comm Toolbox and that it would
- easily solve my problems, let me know about that too.
-
- Thanks muchly.
-
- Scott Kaplan
-
-
- +++++++++++++++++++++++++++
-
- >From egurney@vcd.hp.com (Eddy J. Gurney)
- Date: Tue, 24 May 1994 23:23:40 GMT
- Organization: Hewlett-Packard VCD
-
- Scott Kaplan (sfkaplan@alife.santafe.edu) wrote:
- >Hi there. I'm writing a quick little program which needs to make use of the
- >serial ports (specifically, the modem port attached to, of all things, a
- >modem...).
- >For what this program is doing, it does not seem worth my time to figure out
- >how to use the Comm Toolbox, so I thought I'd do it directly by opening the
- >serial drivers and using good ol' FSRead and FSWrite. I'm having trouble,
- >and I was hoping someone could tell me why.
-
- Check out the sample code on ftp.apple.com:
-
- /dts/mac/sc/snippets/devices/pbxxx-serial-demo.hqx
-
- The snippets directory is a GREAT place to look for answers to ALL of
- your questions BEFORE posting to net...
-
- --
- Eddy J. Gurney N8FPW Hewlett-Packard Company, Vancouver (USA!) Division
- egurney@vcd.hp.com #include <standard-disclaimer.h>
- "Failures are divided into two classes-- those who thought and never did,
- and those who did and never thought." John Charles Salak
-
- +++++++++++++++++++++++++++
-
- >From ab@crosfield.co.uk (Andrew Bradley)
- Date: Thu, 26 May 1994 09:03:15 GMT
- Organization: Crosfield, Hemel Hempstead, UK
-
- In article <2rtmbt$o8m@tierra.santafe.ede> sfkaplan@alife.santafe.edu (Scott Kaplan) writes:
- >Hi there. I'm writing a quick little program which needs to make use of the
- >serial ports (specifically, the modem port attached to, of all things, a
- >modem...).
-
- >Here's the problem. I've go to do an FSRead on the modem port. If there is
- >something waiting in the modem port's buffer, everything's great. However,
- >if there is nothing there (nothing has come in since I read from it last),
- >I die. Rather than returning a count of 0 bytes read in, and rather than
- >returning some error value from FSRead, the machine crashes completely. I
- >have to reboot. So, I am clearly doing something wrong here...
- >
-
-
- I use SerGetBuf to check whats available and read that in - if its zero
- I use my own minimum data size because otherwise the FSRead will hang
- until it got all the bytes you asked for.
-
- Remember the Mac may be written in C but its not UNIX. You have to study
- the Mac libraries very carefully and forget all your unix past !
-
- Regards Andrew
-
-
-
- --
-
-
- |\/\/\/\ Andrew Bradley
- | | Crosfield Electronics Limited
-
- +++++++++++++++++++++++++++
-
- >From cswan@actrix.gen.nz (Chris Swan)
- Date: Thu, 26 May 1994 21:25:04 GMT
- Organization: Actrix Information Exchange
-
- Scott Kaplan <sfkaplan@alife.santafe.edu> wrote:
- > Hi there. I'm writing a quick little program which needs to make use of the
- > serial ports (specifically, the modem port attached to, of all things, a
- > modem...).
- > Here's the problem. I've go to do an FSRead on the modem port. If there is
- > something waiting in the modem port's buffer, everything's great. However,
- > if there is nothing there (nothing has come in since I read from it last),
- > I die. Rather than returning a count of 0 bytes read in, and rather than
- > returning some error value from FSRead, the machine crashes completely. I
- > have to reboot. So, I am clearly doing something wrong here...
-
- I'm not sure why you're crashing but the normal way is to call:
-
- theError:= SerGetBuf(refNum,count);
- if (theError=noErr) and (count>0) then
- theError:= FSRead(refNum,count,buffPtr);
-
- works for me !
- --
- Chris Swan
- cswan@actrix.gen.nz
- --
-
-
- +++++++++++++++++++++++++++
-
- >From Bruce@hoult.actrix.gen.nz (Bruce Hoult)
- Date: Fri, 27 May 1994 14:08:43 +1200 (NZST)
- Organization: (none)
-
- sfkaplan@alife.santafe.edu (Scott Kaplan) writes:
- > Here's the problem. I've go to do an FSRead on the modem port. If there is
- > something waiting in the modem port's buffer, everything's great. However,
- > if there is nothing there (nothing has come in since I read from it last),
- > I die. Rather than returning a count of 0 bytes read in, and rather than
- > returning some error value from FSRead, the machine crashes completely. I
- > have to reboot. So, I am clearly doing something wrong here...
-
- The machine hasn't crashed -- it's just waiting for the data you asked for.
-
- If you want your program to continue if there's nothing there then use...
-
- SerGetBuf(refNum:INTEGER;VAR count:LONGINT):OSErr;
-
- ...to find out how many bytes are available, and then ask for at most
- that many in your FSRead.
-
- -- Bruce
-
- btw, I just used ObiWan to paste the definition of SerGetBuf. It's nice, but
- what I *hate* about it is that the first time I use it after a restart, it
- puts up a much larger window and all my Icons that are nicely arranged along
- the bottom of my Finder desktop somehow get moved to the RH side of the desktop.
-
- ::aaaarggghhhh::
-
- +++++++++++++++++++++++++++
-
- >From gurgle@netcom.com (Pete Gontier)
- Date: Fri, 27 May 1994 21:33:37 GMT
- Organization: cellular
-
- ab@crosfield.co.uk (Andrew Bradley) writes:
-
- >Remember the Mac may be written in C but its not UNIX.
-
- I know it's a persistent rumor, but the Mac ROMs were not written in any
- particular high-level language. I guess from now on the Power Mac ROMs
- will mostly be written in C, or perhaps C++, but from what I understand,
- much of that work has not yet been released. It's still mostly 68K
- assembly using the Pascal calling convention.
- --
- Pete Gontier, CTO, Integer Poet Software; gurgle@netcom.com
-
- "Bedrock does support a form of drag and drop. Development dragged on
- for about two years, and then was dropped." -- Brian Clark
-
- +++++++++++++++++++++++++++
-
- >From sfkaplan@alife.santafe.edu (Scott Kaplan)
- Date: 29 May 1994 16:43:44 GMT
- Organization: The Santa Fe Institute
-
- Many thanks to those that responded! I know now of a very useful place
- for sample source code from Apple, which will always be a good thing. More-
- over, I now know what I was doing wrong. Sure enough, the use of SerGetBuf
- fixed my troubles.
-
- My apologies for not having read through the serial driver toolbox routines
- more carefully. It's been a little while since I had done Mac programming,
- so I had fallen out of that good habit.
-
- Scott Kaplan
- sfkaplan@santafe.edu
-
-
- ---------------------------
-
- >From stevenj@ATHENA.MIT.EDU (Steven G. Johnson)
- Subject: THINK Class Library FTP Site?
- Date: 26 May 1994 18:32:48 GMT
- Organization: Massachvsetts Institvte of Technology
-
- There used to be an FTP site containing an archive of classes that
- people have written for TCL. It was connected to a mailing list
- (called TCL-talk, I think), and was located at ftp.brown.edu.
- However, I looked at this site today and I couldn't find anything!
- Does anyone know what has happened to the archive (and the mailing
- list)? Has it been moved to someplace else? If so, where?
-
- Please email all responses, as it is difficult for me to read this
- newsgroup at the moment. I will post a summary of the replies if
- anyone is interested. Thanks!
-
- Cordially,
- Steven G. Johnson
-
- +++++++++++++++++++++++++++
-
- >From stevenj@ATHENA.MIT.EDU (Steven G. Johnson)
- Date: 27 May 1994 16:28:35 GMT
- Organization: Massachvsetts Institvte of Technology
-
- I recently posted a request for the location of the FTP site
- containing TCL classes and functions. I was told that the new site
- is: daemon.ncsa.uiuc.edu (I checked it out and this is indeed the
- correct address).
-
- Thanks to all who replied.
-
- Cordially,
- Steven G. Johnson
-
- ---------------------------
-
- >From Will Husain <whusain@azedlink1.state.az.us>
- Subject: storage for XCMDS
- Date: 23 May 1994 14:51:52 GMT
- Organization: k12
-
- I'd like to write an XCMD for hypercard that will store information
- between successive calls from hypercard. How can I keep track of global
- data with this kind of resource?
-
- Thanks for any suggestions
-
- Will Glass-Husain
- Catalina Foothills High School
- whusain@k12.az.us
-
- +++++++++++++++++++++++++++
-
- >From alex@metcalf.demon.co.uk (Alex Metcalf)
- Date: Tue, 24 May 1994 12:02:21 GMT
- Organization: Best Before Yesterday
-
- In article <2rqfu8$ffs@azedlink1.ade.state.az.us>, Will Husain
- <whusain@azedlink1.state.az.us> wrote:
-
- > I'd like to write an XCMD for hypercard that will store information
- > between successive calls from hypercard. How can I keep track of global
- > data with this kind of resource?
-
- You first need to make up your own struct of information which you want to
- keep, something like this:
-
- typedef struct
- {
- Ptr myMemory;
- long myLong;
- short myShort;
- } MyData, *MyDataPtr;
-
- So, you use NewPtr to make some space on the heap for your data. Then, you
- take the pointer (to your data), typecast it to a 'long', use NumToString,
- and store the string (which is actually the address of your info) in a
- HyperCard global variable using SetGlobal.
-
- Next time round, use GetGlobal, use StringToNum, and then typecast back to
- a pointer. You can then access your information.
-
- Hope this helps! Get in touch if you have any other questions.
-
-
- Best wishes,
-
-
-
-
- Alex
-
- --
- Alex Metcalf, Best Before Yesterday
- Mac programmer in C, C++, HyperTalk, assembler
-
- Internet, AOL, BIX: alex@metcalf.demon.co.uk "Surely you
- AppleLink: alex@metcalf.demon.co.uk@internet# can't be
- CompuServe: INTERNET:alex@metcalf.demon.co.uk serious?"
- Delphi: alex@metcalf.demon.co.uk@inet#
- FirstClass: alex@metcalf.demon.co.uk,Internet "I am serious...
- Fax (UK): (0570) 45636 and don't call
- Fax (US / Canada): 011 44 570 45636 me Shirley."
-
- +++++++++++++++++++++++++++
-
- >From Arne.Venstad@DELAB.SINTEF.no (Arne Venstad)
- Date: 25 May 1994 08:44:02 GMT
- Organization: SINTEF DELAB
-
- In article <alex-240594130138@metcalf.demon.co.uk>,
- alex@metcalf.demon.co.uk (Alex Metcalf) wrote:
- >
- > In article <2rqfu8$ffs@azedlink1.ade.state.az.us>, Will Husain
- > <whusain@azedlink1.state.az.us> wrote:
- >
- > > I'd like to write an XCMD for hypercard that will store information
- > > between successive calls from hypercard. How can I keep track of global
- > > data with this kind of resource?
- >
- > You first need to make up your own struct of information which you want to
- > keep, something like this:
- >
- > typedef struct
- > {
- > Ptr myMemory;
- > long myLong;
- > short myShort;
- > } MyData, *MyDataPtr;
- >
- > So, you use NewPtr to make some space on the heap for your data. Then, you
- > take the pointer (to your data), typecast it to a 'long', use NumToString,
- > and store the string (which is actually the address of your info) in a
- > HyperCard global variable using SetGlobal.
- >
- >...
-
- I do not think it is wise to allocate locked memory blocks behind
- the back of HyperCard. I would therefore suggest you use NewHandle
- instead of NewPtr, and always unlock it before returning to HyperCard.
- Otherwise the schema is ok.
-
- Arne Venstad Internet: Arne.Venstad@delab.sintef.no
- SINTEF DELAB,
- N-7034 Trondheim,
- Norway.
-
- +++++++++++++++++++++++++++
-
- >From alex@metcalf.demon.co.uk (Alex Metcalf)
- Date: Wed, 25 May 1994 12:01:50 GMT
- Organization: Best Before Yesterday
-
- In article <Arne.Venstad-250594103928@mac-df17.er.sintef.no>,
- Arne.Venstad@DELAB.SINTEF.no (Arne Venstad) wrote:
-
- > In article <alex-240594130138@metcalf.demon.co.uk>,
- > alex@metcalf.demon.co.uk (Alex Metcalf) wrote:
- > >
- > > In article <2rqfu8$ffs@azedlink1.ade.state.az.us>, Will Husain
- > > <whusain@azedlink1.state.az.us> wrote:
- > >
- > > > I'd like to write an XCMD for hypercard that will store information
- > > > between successive calls from hypercard. How can I keep track of global
- > > > data with this kind of resource?
- > >
- > > You first need to make up your own struct of information which you want to
- > > keep, something like this:
- > >
- > > typedef struct
- > > {
- > > Ptr myMemory;
- > > long myLong;
- > > short myShort;
- > > } MyData, *MyDataPtr;
- > >
- > > So, you use NewPtr to make some space on the heap for your data. Then, you
- > > take the pointer (to your data), typecast it to a 'long', use NumToString,
- > > and store the string (which is actually the address of your info) in a
- > > HyperCard global variable using SetGlobal.
- > >
- > >...
- >
- > I do not think it is wise to allocate locked memory blocks behind
- > the back of HyperCard. I would therefore suggest you use NewHandle
- > instead of NewPtr, and always unlock it before returning to HyperCard.
- > Otherwise the schema is ok.
-
- I've had problems before with NewHandle: HyperCard enjoys moving memory
- around, especially when stacks are switched/closed. If HyperCard (or the
- system memory fuctions) decide to purge your block then there's no way to
- get your data back.
-
-
-
- Alex
-
- +++++++++++++++++++++++++++
-
- >From Ron_Hunsinger@bmug.org (Ron Hunsinger)
- Date: Wed, 25 May 94 22:52:20 PST
- Organization: Berkeley Macintosh Users Group
-
- Will Husain <whusain@azedlink1.state.az.us> writes:
-
- >I'd like to write an XCMD for hypercard that will store information
- >between successive calls from hypercard. How can I keep track of global
- >data with this kind of resource?
-
- Store the data in a relocatable block, and convert the Handle to that
- block to a string and store the string in a global variable. (Choose a
- name that won't be used by somebody else.)
-
- On entry to the XCMD, get the value of that variable. If it doesn't
- have a value, you know this is the first call of the XCMD, and you should
- allocate your data. If the variable does have a value, convert it
- back to a long, and cast it as a Handle to your data.
-
- -Ron Hunsinger
-
- +++++++++++++++++++++++++++
-
- >From Kevin Marks <Kevin@pinner.demon.co.uk>
- Date: Sat, 28 May 1994 11:08:05 GMT
- Organization: Me
-
- In article <001565AE.fc@bmug.org> Ron Hunsinger, Ron_Hunsinger@bmug.org
- writes:
- >Store the data in a relocatable block, and convert the Handle to that
- >block to a string and store the string in a global variable. (Choose a
- >name that won't be used by somebody else.)
-
- This is a bit dodgy - you can't guarantee that someone else won't trash
- your variable...
- The best way is to write a XWindow instead, and store your Handle in the
- window's refcon. You don't have to show the window if it's not working on
- visual stuf, and thsi means you can send messages to it and set
- properties, so your HyperTalk looks less obscure.
-
- ---------------------------
-
- End of C.S.M.P. Digest
- **********************
-
-
-